package com.ming.interview;

import java.util.Scanner;

/**
 * @Description 一个5位数，判断它是不是回文数。即12321是回文数，个位与万位相同，十位与千位相同。
 * @Author ye.ming
 * @Date Created in 2019/8/26
 */
public class Main22 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入数字:");
        int num = sc.nextInt();
        int length = String.valueOf(num).length();
        int[] arrs = new int[length];

        int i = 0;
        do {
            arrs[i] = num % 10;
            i++;
        } while ((num = num / 10) != 0);

        for (int j = 0; j < length; j++) {
            System.out.println(arrs[j]);
        }
        boolean isReturn = true;

        for (int j = 0; j < length/2; j++) {
            if (arrs[j] != arrs[length - 1 - j]) {
                isReturn = false;
            }
        }
        if (isReturn) {
            System.out.println("该数字是回文!");
        } else {
            System.out.println("该数字不是回文!");
        }
    }


    private static void m1(int m, int n) {

    }


}
